﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Framework;
using Game;
using Cinemachine;

using UnityEngine.AddressableAssets;

using System.Threading;



public class GameRoot : Framework.MonoSingleton<GameRoot>
{
    [SerializeField]
    private Camera m_MainCamera;

    [SerializeField]
    private Camera m_UICamera;

    [SerializeField]
    private RectTransform m_UICanvas;

    [SerializeField]
    private Image m_ImgBg;

    public Camera MainCamera { get { return m_MainCamera; } }
    public Camera UICamera { get { return m_UICamera; } }
    public RectTransform UICanvas { get { return m_UICanvas; } }

    // Start is called before the first frame update
    async void Start()
    {
        Log.Info("[GameRoot] Start");
        SynchronizationContext.SetSynchronizationContext(OneThreadSynchronizationContext.Instance);
        GameEntry.Init();
        await GameEntry.Scene.LoadSceneAsync("MainScene");
        m_ImgBg.gameObject.SetActive(false);
    }

    public void TestEvent1(object sender, EventArgs e)
    {
        Debug.Log("TestEvent1----->" + sender + e);
    }

    public void TestEvent2(object sender, EventArgs e)
    {
        Debug.Log("TestEvent2----->" + sender + e);
    }

    // Update is called once per frame
    void Update()
    {
        OneThreadSynchronizationContext.Instance.Update();
        FrameworkEntry.Update(Time.deltaTime, Time.unscaledDeltaTime);
    }
}
